package com.premedsidekick;

import android.content.Context;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class FAQAdapter extends BaseAdapter {
	String[] headers;
	String[] footers;
	LayoutInflater inflater;
	TextView textview;
	CharSequence sequence;
	
	FAQAdapter(Context context, String[] headers, String[] footers) {
		this.headers = headers;
		this.footers = footers;
		inflater = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return headers.length;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		if (convertView == null) {
			convertView = inflater.inflate(R.layout.faq_entry, null);
			textview = (TextView)convertView.findViewById(R.id.faq_header_textview);
			sequence = Html.fromHtml(headers[position]);
			textview.setText(sequence);
			textview = (TextView)convertView.findViewById(R.id.faq_footer_textview);
			sequence = Html.fromHtml(footers[position]);
			textview.setText(sequence);
		}
		else {
			textview = (TextView)convertView.findViewById(R.id.faq_header_textview);
			sequence = Html.fromHtml(headers[position]);
			textview.setText(sequence);
			textview = (TextView)convertView.findViewById(R.id.faq_footer_textview);
			sequence = Html.fromHtml(footers[position]);
			textview.setText(sequence);
		}
		return convertView;
	}
	

}
